Net use: Drive H: is now connected to h:\username error
I know this has been a problem a long time, but it's still a problem and annoys me. There is no policy that can help this from NOT happening.
Procedure to re-create problem:
Ensure you log on to a laptop with a domain user where H: is mapped to \\server\users\billg
Log on once. then logoff. Remove all network connections (cable/wlan) Log in again (cached credentials) Enable a network connection. e.g. plug the network cable Open CMD and type NET USE H: /HOME You will get the message:
Drive H: is now connected to \\server\users. Your home directory is H:\billg
The policy Always wait for the network at computer startup and logon has no effect on this issue.
Tested: Windows XP and Windows 7.
Workaround script:
Save this to a file mapdrive.vbs and you can call it from anywhere. e.g.
cscript //nologo mapdrive.vbs
(Requires both user and computer to be a member of the domain)
option explicit
dim strUser, adsobj, strHomeDrive, strHomeDir, oNetwork, strDomainName, oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oNetwork = CreateObject("WScript.Network")
strUser = oNetwork.UserName
strDomainName = oNetwork.userDomain
set adsobj = getobject( "WinNT://" & strDomainName & "/" & strUser )
strHomeDrive = adsobj.homeDirDrive
strHomeDir = adsobj.homeDirectory
if oFSO.driveexists(strHomedrive) then
oNetwork.RemoveNetworkDrive strHomeDrive, true
end if
oNetwork.MapNetworkDrive strHomeDrive, strHomeDir
wscript.echo "Homedrive " & strHomeDrive & " mapped to " & strHomeDir & "..."
September 27th, 2010 10:24am